package com.cn.dubbo.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.cn.dubbo.service.GetDubboVersionService;
import com.cn.dubbo.service.HelloService;
import com.cn.dubbo.service.MoudleToNexusService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author whb
 * @create 2021-03-19 14:06
 */
@Controller
@RequestMapping("/hello")
public class HelloController {
    @Reference
    private HelloService helloService;
    @Reference
    private GetDubboVersionService getDubboVersionService;
    @Reference
    private MoudleToNexusService moudleToNexusService;

    @RequestMapping(value = "/getName",produces = {"text/html;charset=utf-8"})
    @ResponseBody
    public String getName(String name){
        return helloService.helloDubbo(name);
    }

    @RequestMapping("/getDubboVersion")
    @ResponseBody
    public String getDubboVersion(){
        return getDubboVersionService.getDubboVersion();
    }

    @RequestMapping("/getFlag")
    @ResponseBody
    public String getflag(){
        if (!moudleToNexusService.isTrue()){
            return "Failed";
        }
        return "Success";
    }
}
